MODULE md1_LIP1_hermite

   USE md1_global_types
   USE md1_global_consts
   IMPLICIT NONE
   PRIVATE
   ! Public procedures
   PUBLIC ::  LIP1_M10,   &
              LIP1_M11,   &
              LIP1_M12,   &
              LIP1_M13,   &
              LIP1_M14

CONTAINS

!-------------------------------------------------------------------------------

   FUNCTION LIP1_M10(p,Q,lambda)

      IMPLICIT NONE
      REAL(REALK), INTENT(IN) :: p, Q, lambda
      REAL(REALK) :: LIP1_M10

      REAL(REALK) :: tmp0, tmp1

      tmp0 = (half * SQRT(PI/p) * (1-Q/lambda)) 
      tmp0 = tmp0 * ( ERF(Q*SQRT(p)) - ERF((Q-lambda)*SQRT(p)) )

      tmp1 = EXP(2*p*Q*lambda - p*Q*Q - p*lambda*lambda)
      tmp1 = tmp1 - EXP(-p*Q*Q)
      tmp1 = tmp1 / (2*p*lambda)

      LIP1_M10 = tmp0 + tmp1

   END FUNCTION LIP1_M10

!-------------------------------------------------------------------------------

   FUNCTION LIP1_M11(p,Q,lambda)

      IMPLICIT NONE
      REAL(REALK), INTENT(IN) :: p, Q, lambda
      REAL(REALK) :: LIP1_M11

      REAL(REALK) :: tmp0, tmp1

      tmp0 = -(half * SQRT(PI/p) / lambda) 
      tmp0 = tmp0 * ( ERF(Q*SQRT(p)) + ERF((lambda-Q)*SQRT(p)) )

      tmp1 = EXP(-p*Q*Q)

      LIP1_M11 = tmp0 + tmp1

   END FUNCTION LIP1_M11

!-------------------------------------------------------------------------------

   FUNCTION LIP1_M12(p,Q,lambda)

      IMPLICIT NONE
      REAL(REALK), INTENT(IN) :: p, Q, lambda
      REAL(REALK) :: LIP1_M12

      REAL(REALK) :: tmp0, tmp1

      tmp0 = -(1+2*p*Q*lambda)/lambda
      tmp0 = tmp0 * EXP(-p*Q*Q)

      tmp1 = EXP(-p*(lambda-Q)*(lambda-Q)) / lambda

      LIP1_M12 = tmp0 + tmp1

   END FUNCTION LIP1_M12

!-------------------------------------------------------------------------------

   FUNCTION LIP1_M13(p,Q,lambda)

      IMPLICIT NONE
      REAL(REALK), INTENT(IN) :: p, Q, lambda
      REAL(REALK) :: LIP1_M13

      REAL(REALK) :: tmp0, tmp1

      LIP1_M13 = zero

   END FUNCTION LIP1_M13

!-------------------------------------------------------------------------------

   FUNCTION LIP1_M14(p,Q,lambda)

      IMPLICIT NONE
      REAL(REALK), INTENT(IN) :: p, Q, lambda
      REAL(REALK) :: LIP1_M14

      LIP1_M14 = zero

   END FUNCTION LIP1_M14

!-------------------------------------------------------------------------------

END MODULE md1_LIP1_hermite

